﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CompositePattern
{
    public class Employee
    {
        private string Name;
        private string Dept;
        private int Salary;
        private List<Employee> Subordinates;

        public Employee(string name,string dept,int sal)
        {
            this.Name = name;
            this.Dept = dept;
            this.Salary = sal;
            this.Subordinates = new List<Employee>();
        }

        public void Add(Employee e)
        {
            this.Subordinates.Add(e);
        }

        public void Remove(Employee e)
        {
            this.Subordinates.Remove(e);
        }

        public List<Employee> GetSubordinates()
        {
            return Subordinates;
        }

        public override string ToString()
        {
            return ("Employee :[ Name : " + Name + ", dept : " + Dept + ", salary :" + Salary + " ]");
        }
    }
}
